package com.SFA.FirstPage;

import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.FrameWork.Common.MainActivity;
import com.SFA.R;
import com.SFA.Message.MessageListActivity;

public class HomePageNewsView extends LinearLayout {
	
	private Context context;
	private TextView tvTitle, tvMore;
	private ListView lvNews;

	public HomePageNewsView(Context context) {
		super(context);
		this.context = context;
	}
	
	public HomePageNewsView(Context context, AttributeSet attrs){
		super(context, attrs);
		final Context c = context;
		LayoutInflater.from(context).inflate(R.layout.homepage_news_view, this, true);
		tvTitle = (TextView)findViewById(R.id.news_title);
		tvMore = (TextView)findViewById(R.id.news_more);
		lvNews = (ListView)findViewById(R.id.lv_news);
		tvMore.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(c, MessageListActivity.class);
				intent.putExtra("URL", MainActivity.MESSAGE_URL);
				c.startActivity(intent);
			}
		});
	}
	
	public void setTvTitle(String title){
		tvTitle.setText(title);
	}
	
	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		//载入数据
		
		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
	}

	public void setTvMore(String more){
		tvMore.setText(more);
	}
	
	

}
